from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
from sklearn.linear_model import LogisticRegression
import pandas as pd

train_sizes = [0.7, 0.75, 0.8]
accuracy_results = {}
X = pd.read_csv('data/pima_train_processed.csv').drop('Outcome', axis=1)
y = pd.read_csv('data/pima_train_processed.csv')['Outcome']

for size in train_sizes:
    X_train, X_test, y_train, y_test = train_test_split(X, y, train_size=size, random_state=42)

    # 训练模型
    model = LogisticRegression(max_iter=1000)
    model.fit(X_train, y_train)

    # 预测并评估
    y_pred = model.predict(X_test)
    accuracy = accuracy_score(y_test, y_pred)
    accuracy_results[size] = accuracy
    print(f"Train size: {size}, Accuracy: {accuracy:.4f}")